package com.example.llw.bluetooth;

import java.util.HashMap;
import java.util.UUID;

/**
 * Created by Doule on 2015/12/1.
 */
public class UUID16Service {
    private static HashMap<UUID, String> uuids = new HashMap();

    public static UUID BLUETOOTH_BASE_UUID = UUID.fromString("00000000-0000-1000-8000-00805F9B34FB");

    public static final UUID IMMEDIATE_ALERT_SERV_UUID      = UUID.fromString("0000" + "1802" + "-0000-1000-8000-00805F9B34FB") ; // Immediate Alert
    public static final UUID LINK_LOSS_SERV_UUID            = UUID.fromString("0000" + "1803" + "-0000-1000-8000-00805F9B34FB") ; // Link Loss
    public static final UUID TX_PWR_LEVEL_SERV_UUID         = UUID.fromString("0000" + "1804" + "-0000-1000-8000-00805F9B34FB") ; // Tx Power
    public static final UUID CURRENT_TIME_SERV_UUID         = UUID.fromString("0000" + "1805" + "-0000-1000-8000-00805F9B34FB") ; // Current Time Service
    public static final UUID REF_TIME_UPDATE_SERV_UUID      = UUID.fromString("0000" + "1806" + "-0000-1000-8000-00805F9B34FB") ; // Reference Time Update Service
    public static final UUID NEXT_DST_CHANGE_SERV_UUID      = UUID.fromString("0000" + "1807" + "-0000-1000-8000-00805F9B34FB") ; // Next DST Change Service
    public static final UUID GLUCOSE_SERV_UUID              = UUID.fromString("0000" + "1808" + "-0000-1000-8000-00805F9B34FB") ; // Glucose
    public static final UUID THERMOMETER_SERV_UUID          = UUID.fromString("0000" + "1809" + "-0000-1000-8000-00805F9B34FB") ; // Health Thermometer
    public static final UUID DEVINFO_SERV_UUID              = UUID.fromString("0000" + "180A" + "-0000-1000-8000-00805F9B34FB") ; // Device Information
    public static final UUID NWA_SERV_UUID                  = UUID.fromString("0000" + "180B" + "-0000-1000-8000-00805F9B34FB") ; // Network Availability
    public static final UUID HEARTRATE_SERV_UUID            = UUID.fromString("0000" + "180D" + "-0000-1000-8000-00805F9B34FB") ; // Heart Rate
    public static final UUID PHONE_ALERT_STS_SERV_UUID      = UUID.fromString("0000" + "180E" + "-0000-1000-8000-00805F9B34FB") ; // Phone Alert Status Service
    public static final UUID BATT_SERV_UUID                 = UUID.fromString("0000" + "180F" + "-0000-1000-8000-00805F9B34FB") ; // Battery Service
    public static final UUID BLOODPRESSURE_SERV_UUID        = UUID.fromString("0000" + "1810" + "-0000-1000-8000-00805F9B34FB") ; // Blood Pressure
    public static final UUID ALERT_NOTIF_SERV_UUID          = UUID.fromString("0000" + "1811" + "-0000-1000-8000-00805F9B34FB") ; // Alert Notification Service
    public static final UUID HID_SERV_UUID                  = UUID.fromString("0000" + "1812" + "-0000-1000-8000-00805F9B34FB") ; // Human Interface Device
    public static final UUID SCAN_PARAM_SERV_UUID           = UUID.fromString("0000" + "1813" + "-0000-1000-8000-00805F9B34FB") ; // Scan Parameters
    public static final UUID RSC_SERV_UUID                  = UUID.fromString("0000" + "1814" + "-0000-1000-8000-00805F9B34FB") ; // Running Speed and Cadence
    public static final UUID CSC_SERV_UUID                  = UUID.fromString("0000" + "1816" + "-0000-1000-8000-00805F9B34FB") ; // Cycling Speed and Cadence
    public static final UUID CYCPWR_SERV_UUID               = UUID.fromString("0000" + "1818" + "-0000-1000-8000-00805F9B34FB") ; // Cycling Power
    public static final UUID LOC_NAV_SERV_UUID              = UUID.fromString("0000" + "1819" + "-0000-1000-8000-00805F9B34FB") ; // Location and Navigation
    public static final UUID GAP_SERVICE_UUID               = UUID.fromString("0000" + "1800" + "-0000-1000-8000-00805F9B34FB") ; // Generic Access Profile
    public static final UUID GATT_SERVICE_UUID              = UUID.fromString("0000" + "1801" + "-0000-1000-8000-00805F9B34FB") ; // Generic Attribute Profile

    public static final UUID WEIGHT_SCALE_SERV_UUID        = UUID.fromString("0000" + "181D" + "-0000-1000-8000-00805F9B34FB") ; // Weight scale service
    public static final UUID BODY_COMPOSITION_SERV_UUID   = UUID.fromString("0000" + "181B" + "-0000-1000-8000-00805F9B34FB") ; // Body composition service

    public static final UUID TI_OAD_SERVICE_UUID   = UUID.fromString("F000" + "FFC0" + "-0451-4000-B000-000000000000") ; // TI OAD service

    public static final UUID TI_CC_SERVICE_UUID   = UUID.fromString("0000" + "CCC0" + "-0000-1000-8000-00805F9B34FB") ; // TI connection control service

    public static final UUID ETEKCITY_LANTERN_SERVICE_UUID   = UUID.fromString("0000" + "FFF0" + "-0000-1000-8000-00805F9B34FB") ; // TI connection control service

    static {
        // Sample Services.
        uuids.put(IMMEDIATE_ALERT_SERV_UUID, "Immediate Alert");
        uuids.put(LINK_LOSS_SERV_UUID, "Link Loss");
        uuids.put(TX_PWR_LEVEL_SERV_UUID, "Tx Power");
        uuids.put(CURRENT_TIME_SERV_UUID, "Current Time Service");
        uuids.put(REF_TIME_UPDATE_SERV_UUID, "Reference Time Update Service");
        uuids.put(NEXT_DST_CHANGE_SERV_UUID, "Next DST Change Service");
        uuids.put(GLUCOSE_SERV_UUID, "Glucose");
        uuids.put(THERMOMETER_SERV_UUID, "Health Thermometer");
        uuids.put(DEVINFO_SERV_UUID, "Device Information");
        uuids.put(NWA_SERV_UUID, "Network Availability");
        uuids.put(HEARTRATE_SERV_UUID, "Heart Rate Service");
        uuids.put(PHONE_ALERT_STS_SERV_UUID, "Phone Alert Status Service");
        uuids.put(BATT_SERV_UUID, "Battery Service");
        uuids.put(BLOODPRESSURE_SERV_UUID, "Blood Pressure");
        uuids.put(ALERT_NOTIF_SERV_UUID, "Alert Notification Service");
        uuids.put(HID_SERV_UUID, "Human Interface Device");
        uuids.put(SCAN_PARAM_SERV_UUID, "Scan Parameters");
        uuids.put(RSC_SERV_UUID, "Running Speed and Cadence");
        uuids.put(CSC_SERV_UUID, "Cycling Speed and Cadence");
        uuids.put(CYCPWR_SERV_UUID, "Cycling Power");
        uuids.put(LOC_NAV_SERV_UUID, "Location and Navigation");
        uuids.put(GAP_SERVICE_UUID, "Generic Access Profile");
        uuids.put(GATT_SERVICE_UUID, "Generic Attribute Profile");

        uuids.put(WEIGHT_SCALE_SERV_UUID, "Weight Scale Service");
        uuids.put(BODY_COMPOSITION_SERV_UUID, "Body Composition Service");

        uuids.put(TI_OAD_SERVICE_UUID, "TI OAD Service");

        uuids.put(TI_CC_SERVICE_UUID, "TI Connection Control Service");
    }


    public static String lookupName(String uuid, String defaultName) {
        String name = uuids.get(UUID.fromString(uuid));
        return name == null ? defaultName : name;
    }
}
